package com.own.business.system.menu.entity.bo;

import com.own.business.system.menu.entity.po.SystemMenu;
import com.own.component.common.base.entity.BaseBo;
import com.own.constant.ConstantBeanSuffix;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * SystemMenuBo
 *
 * @author chenxueli
 * @date 2024-03-31 09:22:58
 */
@Schema(title = "系统菜单" + ConstantBeanSuffix.BO)
@Getter
@Setter
@ToString
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
public class SystemMenuBo extends BaseBo<SystemMenu> implements Serializable {

    /**
     * 菜单编码
     */
    private String code;

    /**
     * 菜单标题
     */
    private String title;

    /**
     * 父级菜单id
     */
    private Long parentId;

    /**
     * 菜单路径
     */
    private String path;

    /**
     * 菜单图标
     */
    private String icon;

    /**
     * 是否禁用 1=禁用 0=可用
     */
    private Integer isDisable;

    /**
     * 是否显示 1=显示 0=隐藏
     */
    private Integer isShow;

    /**
     * 权限标识
     */
    private String permission;

    /**
     * 排序
     */
    private Integer sortOrder;

    /**
     * 客户端id
     */
    private String clientId;

    /**
     * 菜单链名称
     */
    private String chainName;

    /**
     * 菜单链ids
     */
    private String chainIds;

    /**
     * 转持久化对象
     *
     * @param entity 原持久化对象
     * @return 持久化对象
     */
    @Override
    public SystemMenu toPo(SystemMenu entity) {
        if (entity == null) {
            entity = new SystemMenu();
        }
        entity.setCode(this.code);
        entity.setTitle(this.title);
        entity.setParentId(this.parentId);
        entity.setPath(this.path);
        entity.setIcon(this.icon);
        entity.setIsDisable(this.isDisable);
        entity.setIsShow(this.isShow);
        entity.setPermission(this.permission);
        entity.setSortOrder(this.sortOrder);
        entity.setClientId(this.clientId);
        entity.setChainName(this.chainName);
        entity.setChainIds(this.chainIds);
        return super.toPo(entity);
    }

}

